import React from "react";
import { useNavigate, useLocation } from "react-router";

export default function User() {
    // 通过useLocation接收参数
    const location = useLocation()// 获取上个页面传来的参数
    const navigate = useNavigate()
    console.log(location.state.arr) // [1,2,3]

    const backLogin = () => {
        navigate('/login')
    }
    return (
        <div>
            <div>我是abc组件</div>
            <button onClick={backLogin}>返回login页面</button>
        </div>
    )
}

